<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title></title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <!--<link href="../demo.css" rel="stylesheet" type="text/css" />-->
  <script src="/scripts/boot.js" type="text/javascript"></script>
  <script src="/scripts/miniui/miniui.js"></script>

  <style type="text/css">
    body{
      margin:0;padding:0;border:0;width:100%;height:100%;overflow:hidden;
    }
  </style>
</head>
<body>
<div class="mini-toolbar" style="text-align:center;line-height:30px;" borderStyle="border:0;">
  <label >用户名称：</label>
  <input id="nickName" class="mini-textbox" style="width:150px;" onenter="onKeyEnter"/>
  <label >用户登录名：</label>
  <input id="username" class="mini-textbox" style="width:150px;" onenter="onKeyEnter"/>
  <a class="mini-button" style="width:60px;" onclick="search()">查询</a>
</div>
<div class="mini-fit">

  <div id="grid1" class="mini-datagrid" style="width:100%;height:100%;"
       idField="id" allowResize="true" url="/tribeRoute/tribeMGEditSelectCreaterData"
       borderStyle="border-left:0;border-right:0;" onrowdblclick="onRowDblClick"
  >
    <div property="columns">
      <div type="indexcolumn" width="20" align="center" headerAlign="center" ></div>
      <div field="gender"  width="30" align="center" headerAlign="center"  >用户头像</div>
      <div field="objectId" width="80" headerAlign="center" >用户ID</div>
      <div field="nickName" width="80" headerAlign="center" >用户名称</div>
      <div field="username" width="80" headerAlign="center" >用户登录名</div>
      <div field="createAt" width="60" align="center" headerAlign="center" dateFormat="yyyy-MM-dd hh:mm:ss" >创建日期</div>
    </div>
  </div>

</div>
<div class="mini-toolbar" style="text-align:center;padding-top:8px;padding-bottom:8px;" borderStyle="border:0;">
  <a class="mini-button" style="width:60px;" onclick="onOk()">确定</a>
  <span style="display:inline-block;width:25px;"></span>
  <a class="mini-button" style="width:60px;" onclick="onCancel()">取消</a>
</div>

</body>
</html>
<script type="text/javascript">
  mini.parse();
//  mini._destroying =false;
  var grid = mini.get("grid1");
  //动态设置URL
//  grid.setUrl("/tribeRoute/tribeMGEditSelectCreaterData");
  //也可以动态设置列 grid.setColumns([]);

  grid.load();

  grid.on("drawcell", function (e) {
    var  value = e.value;
    column = e.column;
    if (column.field == "gender") {
      if(value) {

        e.cellHtml = '<img class="bigImg"  src="' + value + '?imageMogr2/thumbnail/640x/format/jpg/interlace/1/auto-orient" width="30" height="30" alt="图片">';
      }else{
        e.cellHtml = '<img class="bigImg"  src="http://7xiuo5.com1.z0.glb.clouddn.com/fgImage.png?imageMogr2/auto-orient/thumbnail/!100x100r/gravity/Center/crop/100x100/quality/80/auto-orient" width="30" height="30" alt="图片">';
      }
    }
  });

  function GetData() {
    var row = grid.getSelected();
    return row;
  }
  function search() {
    var nickName = mini.get("nickName").getValue();
    var username = mini.get("username").getValue();
    grid.load({ nickName: nickName,username:username});
  }
  function onKeyEnter(e) {
    search();
  }
  function onRowDblClick(e) {
    onOk();
  }
  //////////////////////////////////
  function CloseWindow(action) {
//    console.log(window.CloseOwnerWindow)
    if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
    else window.close();
  }

  function onOk() {
    CloseWindow("ok");
  }
  function onCancel() {
    CloseWindow("cancel");
  }


</script>